package com.gupao.javavip.rpc.client;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.concurrent.TimeUnit;

public class RPCClientApplication {
    public static void main(String[] args) throws InterruptedException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
        context.start();

        for (; ; ) {
            sendRequest(context);

            TimeUnit.SECONDS.sleep(5);
        }
    }

    private static void sendRequest(AnnotationConfigApplicationContext context) {
        UserServiceClient client = context.getBean(UserServiceClient.class);
        client.addUser();
        client.sayHello();
    }
}
